home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Moscow ML 1.31 / source code / mosml / src / mosmllib / Timer.sig < prev    next >
Encoding:
Text File  |  1996-07-03  |  1.4 KB  |  45 lines  |  [TEXT/R*ch]

  1. (* Timer -- SML Standard Library *)
  2.  
  3. local 
  4.     type time = Time.time
  5. in
  6.     type cpu_timer
  7.     type real_timer
  8.  
  9.     val totalCPUTimer : unit -> cpu_timer
  10.     val startCPUTimer : unit -> cpu_timer
  11.     val checkCPUTimer : cpu_timer -> {usr : time, sys : time, gc : time}
  12.  
  13.     val totalRealTimer : unit -> real_timer
  14.     val startRealTimer : unit -> real_timer
  15.     val checkRealTimer : real_timer -> time
  16. end
  17.  
  18. (*  A [cpu_timer] measures the CPU time consumed.
  19.  
  20.     A [real_timer] measures the real time that has passed.
  21.  
  22.     [totalCPUTimer ()] returns the cpu_timer that was started when the
  23.     Timer library was loaded.
  24.  
  25.     [startCPUTimer ()] returns a cpu_timer started at the moment of 
  26.     the call.
  27.  
  28.     [checkCPUTimer tmr] returns {usr, sys, gc} where usr is the amount
  29.     of user CPU time consumed since tmr was started, gc is the amount
  30.     of user CPU time spent on garbage collection, and sys is the
  31.     amount of system CPU time consumed since tmr was started.  Note
  32.     that gc time is included in the usr time.  Under MS DOS, usr time
  33.     and gc time are measured in real time.
  34.  
  35.     [startRealTimer ()] returns a real_timer started at the moment of 
  36.     the call.
  37.  
  38.     [totalRealTimer ()] returns the real_timer that was started when
  39.     the Timer library was loaded.
  40.  
  41.     [checkRealTimer tmr] returns the amount of real time that has passed
  42.     since tmr was started.
  43. *)
  44.  
  45.